package com.awspaas.user.apps.publicservice.util;

import java.nio.charset.StandardCharsets;
import java.util.Base64;

/**
 * @author:Lizj
 * @create: 2022-08-16 10:55
 * @Description: base64工具类
 */
public class Base64Util {

    final static Base64.Encoder encoder = Base64.getUrlEncoder();
    final static Base64.Decoder decoder = Base64.getUrlDecoder();

    public static String encode(String text) {
        return encoder.encodeToString(text.getBytes(StandardCharsets.UTF_8));
    }

    public static String decode(String encodedText) {
        return new String(decoder.decode(encodedText), StandardCharsets.UTF_8);
    }

}
